﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Data.SqlClient;

namespace _24._01.CS
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            this.sqlConnection1.ConnectionString =
               "Integrated Security=SSPI;" +
               "Persist Security Info=False;" +
               "User ID='';" +
               "Initial Catalog=NorthWind;" +
               "Data Source=HP;" +
               "Initial File Name=''";
        }

        private void btnLeggiDato_Click(object sender, EventArgs e)
        {
            string SQL =
                "SELECT COUNT(*) AS Numero FROM Clienti";
            this.sqlConnection1.Open();
            SqlCommand Comando = new SqlCommand(
                SQL, this.sqlConnection1);
            int Numero = Convert.ToInt32(Comando.ExecuteScalar());
            this.sqlConnection1.Close();
            this.Label1.Text =
                "Numero record 'Clienti': " + Numero;
        }
    }
}
